import request from '@/utils/request'

// 创建员工
export function createStaff(data) {
  return request({
    url: '/biz/staff/create',
    method: 'post',
    data: data
  })
}

// 更新员工
export function updateStaff(data) {
  return request({
    url: '/biz/staff/update',
    method: 'put',
    data: data
  })
}

// 删除员工
export function deleteStaff(id) {
  return request({
    url: '/biz/staff/delete?id=' + id,
    method: 'delete'
  })
}

// 获得员工
export function getStaff(id) {
  return request({
    url: '/biz/staff/get?id=' + id,
    method: 'get'
  })
}

// 获得员工
export function getStaffByCode(staffCode) {
  return request({
    url: '/biz/staff/getStaffByCode?staffCode=' + staffCode,
    method: 'get'
  })
}

// 获得员工分页
export function getStaffPage(query) {
  return request({
    url: '/biz/staff/page',
    method: 'get',
    params: query
  })
}

// 获得员工list
export function getStaffListAll(query) {
  return request({
    url: '/biz/staff/listAll',
    method: 'get',
    params: query
  })
}

// 导出员工 Excel
export function exportStaffExcel(query) {
  return request({
    url: '/biz/staff/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 根据部门获取员工
export function getStaffByDeptId(deptId) {
  return request({
    url: '/biz/staff/getStaffByDeptId?deptId='+deptId,
    method: 'get'
  })
}